<!DOCTYPE html>
<html lang="zh">
<head>
  <!--<meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>红梅食品</title>-->

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>味精制作动画</title>
  <style>
    /* 全局样式 */
    body {
      margin: 0;
      padding: 0;
      font-family: Arial, sans-serif;
      background-color: #f9f9f9;
      line-height: 1.6;
    }

    /* 顶部导航 */
    header {
      background-color: #d00000;
      color: white;
      padding: 1rem 0;
      text-align: center;
    }

    header img {
      max-height: 50px;
    }

    /* 主内容区域 */
    .container {
      margin: 1rem auto;
      padding: 1rem;
      max-width: 640px;
      background-color: white;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      border-radius: 8px;
    }

    .container h2 {
      margin-top: 0;
      color: #d00000;
      font-size: 1.5rem;
      border-bottom: 2px solid #d00000;
      padding-bottom: 0.5rem;
    }

    .about p {
      margin: 0.5rem 0;
      text-align: justify;
    }

    /* 数字展示区域 */
    .highlights {
      display: flex;
      justify-content: space-around;
      background-color: #f4f4f4;
      padding: 1rem 0;
      margin: 2rem auto;
      border-radius: 8px;
      font-size: 1.2rem;
      font-weight: bold;
    }

    .highlights div {
      text-align: center;
      color: #d00000;
    }

    /* 产品图片 */
    .poster img {
      display: block;
      width: 100%;
      border-radius: 8px;
    }

    /* 页脚 */
    footer {
      background-color: #d00000;
      color: white;
      text-align: center;
      padding: 1rem 0;
      margin-top: 2rem;
    }

    /* 顶部导航 */
    header {
      background-color: #d00000;
      color: white;
      display: flex;
      align-items: center;
      width: auto;
      justify-content: space-between;
      padding: 0.5rem 1rem;
      position: relative;
    }

    header img {
      max-height: 50px;
    }

    /* 菜单按钮 */
    .menu-toggle {
      display: none;
      font-size: 1.5rem;
      background: none;
      border: none;
      color: white;
      cursor: pointer;
    }

    /* 导航菜单 */
    nav {
      display: flex;
      gap: 1rem;
    }

    nav a {
      color: white;
      text-decoration: none;
      font-size: 1rem;
    }

    nav a:hover {
      text-decoration: underline;
    }

    /* 移动端样式 */
    @media (max-width: 768px) {
      .menu-toggle {
        display: block;
      }

      nav {
        display: none;
        flex-direction: column;
        background-color: #d00000;
        /*position: absolute;
        top: 100%;
        right: 0;
        width: 100%;
        padding: 1rem 0;*/
        position: fixed; /* 固定定位 */
        top: 0; /* 让菜单显示在页面顶部 */
        right: 0;
        width: 100%;
        padding: 1rem 0;
        z-index: 9999; /* 确保菜单在最上层 */

      }

      nav a {
        padding: 0.5rem 1rem;
      }

      nav.active {
        display: flex !important;
      }
    }
  </style>


  <style>
    body {
      font-family: Arial, sans-serif;
      text-align: center;
      margin: 20px;
    }

    .container {
      margin: 20px auto;
      width: 300px;
      height: 300px;
      border: 2px solid #000;
      border-radius: 10px;
      position: relative;
      background: #f3f3f3;
    }

    .materials {
      display: flex;
      justify-content: center;
      gap: 10px;
      margin-top: 20px;
    }

    .material {
      width: 50px;
      height: 50px;
      background: #ffd700;
      border-radius: 50%;
      line-height: 50px;
      text-align: center;
      font-size: 14px;
      cursor: pointer;
      user-select: none;
    }

    #output {
      margin-top: 20px;
      font-size: 18px;
      color: #555;
    }

    .crystal {
      position: absolute;
      width: 30px;
      height: 30px;
      background: #b0e0e6;
      border-radius: 5px;
      animation: float 3s infinite ease-in-out;
    }

    @keyframes float {
      0% {
        transform: translateY(0);
      }
      50% {
        transform: translateY(-20px);
      }
      100% {
        transform: translateY(0);
      }
    }
  </style>

</head>
<body>
<!-- 顶部 -->
<header>
  <!-- Logo -->
  <img src="/src/img/logo.png" alt="红梅食品 Logo" style="max-height: 35px;">

  <!-- 菜单按钮（移动端可见） -->
  <button class="menu-toggle" onclick="toggleMenu()">☰</button>

  <!-- 导航菜单 -->
  <nav id="mobile-nav">
    <a href="one.html">首页</a>
    <a href="two.html">红梅简介</a>
    <a href="three.html">原料介绍</a>
    <a href="four.html">制作过程</a>
    <a href="five.html">开始投放市场</a>
  </nav>
</header>
<h1>味精制作</h1>

<div class="container" id="reactor">
  <p id="output">将原材料加入容器中。</p>
</div>

<div class="materials">
  <div class="material" onclick="addMaterial('玉米')">玉米</div>
  <div class="material" onclick="addMaterial('甘蔗')">甘蔗</div>
  <div class="material" onclick="addMaterial('其他')">其他</div>
</div>

<button onclick="startProduction()">开始制作</button>

<script>
  const reactor = document.getElementById('reactor');
  const output = document.getElementById('output');
  let materials = [];

  // 添加原材料到反应容器
  function addMaterial(material) {
    materials.push(material);
    output.textContent = `已添加: ${materials.join(', ')}`;
  }

  // 开始制作味精
  function startProduction() {
    if (materials.length === 0) {
      output.textContent = '请先添加原材料！';
      return;
    }

    output.textContent = '反应容器开始工作，正在制作味精...';
    // 模拟反应容器动画
    setTimeout(() => {
      output.textContent = '味精晶体生成！';
      generateCrystals();
    }, 3000); // 3秒制作时间
  }

  // 生成味精晶体动画
  function generateCrystals() {
    for (let i = 0; i < 5; i++) {
      const crystal = document.createElement('div');
      crystal.className = 'crystal';
      crystal.style.left = `${Math.random() * 260 + 20}px`;
      crystal.style.top = `${Math.random() * 260 + 20}px`;
      reactor.appendChild(crystal);

      // 移除晶体动画
      setTimeout(() => {
        crystal.remove();
      }, 5000); // 晶体持续5秒
    }
  }
</script>
<!-- 页脚 -->
<footer>
  <p>红梅食品 创造生活高品质</p>
  <p>HONGMEI FOOD CREATES HIGH QUALITY OF LIFE</p>
</footer>
<script>
  function toggleMenu() {
    const nav = document.getElementById('mobile-nav');
    nav.classList.toggle('active');
  }
</script>
</body>
</html>
